package ee.ttu.rakarh.controller;

import org.apache.log4j.Logger;

public class IndexController {
	
	public static final Logger LOG = Logger.getLogger(IndexController.class);
	
	IndexController(){}
	
	public String getBodyModule(String action){
		System.out.println(action);
		String bodyModul = "Avaleht.jsp";
		if(action.equals("index")){ bodyModul = "Avaleht.jsp"; }
		if(action.equals("kataloog")){ bodyModul = "catalog.jsp"; }
		if(action.equals("laod")){ bodyModul = "Laod.jsp"; }
		if(action.equals("addItem")){ bodyModul = "AddItem.jsp"; }
		if(action.equals("getCheckInForm")){ bodyModul = "AddToStore.jsp"; }
		if(action.equals("getCheckOutForm")){ bodyModul = "RemoveFromStore.jsp"; }
		if(action.equals("getChangeStoreForm")){ bodyModul = "MoveToStore.jsp"; }
		if(action.equals("searchItem")){ bodyModul = "searchItem.jsp"; }
		if(action.equals("searchItemResults")){ bodyModul = "searchItemResults.jsp"; }
		if(action.equals("addResult")){ bodyModul = "addResult.jsp"; }
		if(action.equals("login")){ bodyModul = "login.jsp"; }
		if(action.equals("getUpdateItemForm")){ bodyModul = "updateItemForm.jsp"; }
		if(action.equals("updateResult")){ bodyModul = "updateResult.jsp"; }
		if(action.equals("getItem")){ bodyModul = "browseItemForm.jsp"; }
		if(action.equals("showPriceList")){ bodyModul = "PriceList.jsp"; }
		if(action.equals("addPriceListForm")){ bodyModul = "AddPriceListForm.jsp"; }
		if(action.equals("addToStore")){ bodyModul = "AddToStoreAJAX.jsp"; }
		if(action.equals("removeFromStore")){ bodyModul = "AddToStoreAJAX.jsp"; }
		
		if(bodyModul.equals("")){
			LOG.error("Can not find body modul to this parameter: " + action);
		}
		
		return bodyModul;
	}
	
}
